<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<base href="<%=request.getContextPath()%>/">
<link rel="stylesheet" href="about/css/bootstrap.min.css">
<link href="cs" type="text/css" rel="stylesheet">
<link href="about/css/main.css" type="text/css" rel="stylesheet">
<link href="about/css/base.css" type="text/css" rel="stylesheet">
<!--按钮样式表-->
<link href="about/css/btn.css" type="text/css" rel="stylesheet">
<link href="about/css/css.css" type="text/css" rel="stylesheet">
<link href="about/css/index.css" type="text/css" rel="stylesheet">
<link href="about/css/search.css" type="text/css" rel="stylesheet">
<script src="about/js/jquery.min.js"></script>
<script src="about/js/bootstrap.min.js"></script>
<title>护理内容</title>

<script type="text/javascript">
	$(function() {
		var myModal1 = $(".myModal1");
		var xthlnr = $("#xthlnr");
		xthlnr.click(function(evt) {
			myModal1.show();
		});
	})
</script>
</head>
<body>
	<div class="hlnr page">
		<div class="col-md-12 pd20 RightContentBody fmt10">
			<div class="col-md-3 pd0 fmt5">
				<form action="hlgl/hlnr/list.do" method="post" id="form">
				<div class="input-group inputWidth_search">
					<input type="text" class="form-control" placeholder="名称" name="key"> <span
						class="input-group-addon"><a
						href="javascript:document:form.submit();" >查询</a></span>
						
				</div>
				</form>
			</div>
			<div class="col-md-9 pd0 fmt5">
				<button id="xthlnr" class="btn btn-primary" data-toggle="modal"
					data-target=".myModal1">
					<span class="glyphicon glyphicon-plus"></span>&nbsp;添加
				</button>
			</div>
			
			<div class="modal fade myModal1">
				<div class="modal-dialog">
					<div class="modal-content" style="width: 100%;">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"
								aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>
							<span class="glyphicon glyphicon-pencil"></span>&nbsp;【添加护理内容】
						</div>
						<form action="hlgl/hlnr/add.do" method="post" >
						<div class="modal-body clearfix" style="height: auto;">
							<div class="col-md-12 pd0">
								<div class="col-md-1 pd0 mt10"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;编号：</span>
											<input type="text" name="serlalNumber" class="form-control"
												placeholder="请输入【编号】信息" aria-describedby="basic-addon1" value="HLXM">
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;名称：</span>
											<input type="text" name="name" class="form-control"
												placeholder="请输入【名称】信息" aria-describedby="basic-addon1">
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;价格：</span>
											<input type="text" name="price" class="form-control">
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;描述：</span>
											<input type="text" name="remarks" class="form-control"
												placeholder="请输入【描述】信息" aria-describedby="basic-addon1">
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;是否增值服务：</span>
											<select class="form-control" name="increment">
												<option value="0">否</option>
												<option value="1">是</option>
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;状态：</span>
											<select class="form-control" name="status">
												<option value="1">启用</option>
												<option value="0">禁用</option>
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;备注：</span>
											<input type="text" name="describe" class="form-control"
												aria-describedby="basic-addon1">
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
						</div>
						<div class="modal-footer mt20">
							<button type="submit" class="btn btn-primary"
							>确定</button>
							<button type="button" class="btn btn-default"
								data-dismiss="modal">取消</button>
						</div>
						</form>
					</div>
				</div>
			</div>
			<div class="col-md-12 pd0 fmt10">
				<hr class="commonHRCss" />
			</div>
			<div class="col-md-12 pd0">
				<table class="table table-hover">
					<thead>
						<tr>
							<th>序号</th>
							<th>编号</th>
							<th>名称</th>
							<th>价格</th>
							<th>描述</th>
							<th>是否增值服务</th>
							<th>状态</th>
							<th>备注</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
					<c:if var="found" test="${not empty requestScope.nct.rows}" scope="page">
						<c:forEach var="r" items="${requestScope.nct.rows}" varStatus="vs">
							<tr>
							<td>${vs.count}</td>
							<td>${r.serlalNumber}</td>
							<td>${r.name}</td>
							<td>${r.price}元/次</td>
							<td>${r.describe}</td>
							<c:if var="increment" test="${r.incrementFlag==true}" scope="page">
								<td>是</td>
							</c:if>
							<c:if test="${!increment}">
								<td>否</td>
							</c:if>
							<c:if  test="${r.status}" >
								<td>启用</td>
							</c:if>
							<c:if test="${!r.status}">
								<td>禁用</td>
							</c:if>
							<td>${r.remarks}</td>
							<td>	<a href="#" data-toggle="modal" data-target=".myModal2">
									<button class="btn btn-primary" type="button" onclick="setId(${r.id})">修改</button>
							 	</a>	<a href='/beadhouse/hlgl/hlnr/remove.do?id=${r.id}'>
									<button class="btn btn-danger">删除</button>
							</a></td>
							<tr>
						</c:forEach>
					</c:if>
					
					</tbody>
				</table>
			</div>
			<div class="col-md-12 pd0">
				<div class="col-md-12 text-right pd0 fmt20">
					<nav aria-label="Page navigation">
					<ul class="pagination">
							<li><a href="hlgl/hlnr/list.do?pageno=${nct.pageNo-1}" aria-label="Previous"> <span
								aria-hidden="true">&laquo;</span>
						</a></li>
						<c:forEach begin="1" end="${nct.totalPages}" var="r">
							<li><a href="hlgl/hlnr/list.do?pageno=${r}" >${r}</a></li>
						</c:forEach>
						<c:if test="${nct.pageNo!=nct.totalPages}">
							<li><a href="hlgl/hlnr/list.do?pageno=${nct.pageNo+1}" aria-label="Next"> <span
								aria-hidden="true">&raquo;</span>
						</a></li>
						</c:if>
					</ul>
					</nav>
				</div>
			</div>
			<div class="modal fade myModal2">
				<div class="modal-dialog">
					<div class="modal-content" style="width: 100%;">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"
								aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>
							<span class="glyphicon glyphicon-pencil"></span>&nbsp;【修改护理内容】
						</div>
						<form action="hlgl/hlnr/modify.do" method="post" >
						<div class="modal-body clearfix" style="height: auto;">
							<div class="col-md-12 pd0">
								<div class="col-md-1 pd0 mt10"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<input id="idEl" name="id" hidden>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;名称：</span>
											<input type="text" name="name" class="form-control" id="nameEl"
												placeholder="请输入【名称】信息" aria-describedby="basic-addon1">
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;价格：</span>
											<input type="text" name="price" class="form-control" id="priceEl">
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;描述：</span>
											<input type="text" name="remarks" class="form-control" id="remarksEl"
												placeholder="请输入【描述】信息" aria-describedby="basic-addon1">
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;是否增值服务：</span>
											<select class="form-control" name="increment" id="incrementEl">
												<option value="0">否</option>
												<option value="1">是</option>
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;状态：</span>
											<select class="form-control" name="status" id="statusEl">
												<option value="1">启用</option>
												<option value="0">禁用</option>
											</select>
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
							<div class="col-md-12 pd0 mt10">
								<div class="col-md-1 pd0"></div>
								<div class="col-md-10 pd0">
									<div class="col-md-12 pd0">
										<div class="input-group inputWidth">
											<span class="input-group-addon titleWidth">&nbsp;&nbsp;备注：</span>
											<input type="text" name="describe" class="form-control" id="describeEl"
												aria-describedby="basic-addon1">
										</div>
									</div>
								</div>
								<div class="col-md-1 pd0"></div>
							</div>
						</div>
						<div class="modal-footer mt20">
							<button type="submit" class="btn btn-primary"
							>确定</button>
							<button type="button" class="btn btn-default"
								data-dismiss="modal">取消</button>
						</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
		var $idEl=$("#idEl");
		var $nameEl=$("#nameEl");
		var $priceEl=$("#priceEl");
		var $remarksEl=$("#remarksEl");
		var $incrementEl=$("#incrementEl");
		var $statusEl=$("#statusEl");
		var $describeEl=$("#describeEl");
		function setId(id) {
			$idEl.val(id);
			$.get("api/hlgl/hlnr/onenurcontent",{nurId:id},function(resp){
				console.log(resp);
				if(resp.code==="ok"){
					$nameEl.val(resp.data.name);
					$priceEl.val(resp.data.price);
					$remarksEl.val(resp.data.remarks);
					if(resp.data.increment===true){
						$incrementEl.val(1);
					}else{
						$incrementEl.val(0);
					}
					if(resp.data.status===true){
						$statusEl.val(1);
					}else{
						$statusEl.val(0);
					}
					$describeEl.val(resp.data.describe);
				}
			});
		}
	</script>
</body>
</html>